package jee.boot.module.bpm.validation;

import jee.boot.common.basic.ServiceException;

/**
 * 数字+字母校验
 */
public class NumberLetterValidation extends BasicValidation implements DataValidation {
    /**
     * 英文和数字：
     */
    private String pattern = "^[A-Za-z0-9]+$";

    /**
     * 数据校验
     *
     * @param value
     * @param params
     */
    @Override
    public void validation(Object value, Object... params) {
        if (value == null) {
            return;
        }
        boolean matches = matches(value.toString(), pattern);
        if (!matches) {
            throw new ServiceException(1429);
        }
    }
}
